//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.sdhs.system.syncdata.util;

import io.swagger.annotations.*;

import java.io.*;

@ApiModel("响应")
public class ResultUser<T> implements Serializable {
    private static final long serialVersionUID = 1L;
//    @ApiModelProperty("编码：0表示成功，其他值表示失败")
//    private int code = 0;
//    @ApiModelProperty("消息内容")
//    private String msg = "success";
    @ApiModelProperty("编码：0表示成功，其他值表示失败")
    private String resultCode = "0";
    @ApiModelProperty("消息内容")
    private String message = "success";
    @ApiModelProperty("随机码")
    private String bimRequestId;
    @ApiModelProperty("响应数据")
    private T userIdList;



    public ResultUser() {
    }

    public ResultUser<T> ok(T data) {
        this.setUserIdList(data);
        return this;
    }

    public boolean success() {
        return this.resultCode == "0";
    }

    public static <T> ResultUser<T> success(T data) {
        return (new ResultUser()).ok(data);
    }

    public static <T> ResultUser<T> badRequest(String msg, String code) {
        return (new ResultUser()).error(code, msg);
    }

    public ResultUser<T> error() {
        this.resultCode = "500";
        this.message = MessUtils.getMessage(this.resultCode);
        return this;
    }

//    public ResultUser<T> error(String code) {
//        this.resultCode = code;
//        this.message = MessUtils.getMessage(this.resultCode);
//        return this;
//    }

    public ResultUser<T> error(String code, String msg) {
        this.resultCode = code;
        this.message = msg;
        return this;
    }

    public ResultUser<T> error(String msg) {
        this.resultCode = "500";
        this.message = MessUtils.getMessage(this.resultCode);
//        this.message = msg;
        return this;
    }

    public String getResultCode() {
        return resultCode;
    }

    public void setResultCode(String resultCode) {
        this.resultCode = resultCode;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getBimRequestId() {
        return bimRequestId;
    }

    public void setBimRequestId(String bimRequestId) {
        this.bimRequestId = bimRequestId;
    }

    public T getUserIdList() {
        return userIdList;
    }

    public void setUserIdList(T userIdList) {
        this.userIdList = userIdList;
    }
}
